<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<link href="${pageContext.request.contextPath}/css/style.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath}/css/table.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath}/dwz/themes/default/style.css" rel="stylesheet" type="text/css" media="screen" />
<link href="${pageContext.request.contextPath}/dwz/themes/css/core.css" rel="stylesheet" type="text/css" media="screen" />
<script src="${pageContext.request.contextPath}/jquery/jquery-2.1.4.min.js" type="text/javascript"></script>
<form id="permissionForm">
<table border="0" cellpadding="0" cellspacing="0" class="table_border">
	<tr>
		<td>
			<table width="100%" border="0" cellpadding="0" cellspacing="0"
				class="table_right">
				<tr>
					<td><font style="font-size: 12px;"><strong>修改许可</strong></font>
					</td>
					<td width="25" height="26" align="left"></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td>
			<table width="100%" border="0" cellspacing="0" class="table_right">
				<tr>
					<td align="center">



						<table border="0" cellpadding="0" cellspacing="0"
							class="box_table" id="box_table2">
							<thead>
								<input type="hidden" name="id" value="${permission.id}" >
								<tr>
									<td height="36" class="box_table_even">代码：</td>
									<td class="box_table_odd">
										<input name="code" value="${permission.code}" type="text" />
										<span class="warningPrompt"></span>
										<span class="star">*</span>
									</td>
								</tr>
								<tr>
									<td height="36" class="box_table_even">名称：</td>
									<td class="box_table_odd">
										<input name="name" id="name" value="${permission.name}" type="text" />
										<span class="warningPrompt"></span>
										<span class="star">*</span>
									</td>
								</tr>
								<tr>
									<td class="box_table_even">模块URL：</td>
									<td class="box_table_odd">
										<input name="moduleUrl" value="${permission.moduleUrl}" type="text" />
										<span class="warningPrompt"></span>
									</td>
								</tr>
								<tr>
									<td class="box_table_even">操作URL：</td>
									<td class="box_table_odd">
										<input name="operationUrl" value="${permission.operationUrl}" type="text" size="90" />
										多个逗号隔开
										<span class="warningPrompt"></span>
									</td>
								</tr>
								<tr>
									<td class="box_table_even">排序号：</td>
									<td class="box_table_odd">
										<input name="orderNo" value="${permission.orderNo}" type="text" />
										<span class="warningPrompt"></span>
									</td>
								</tr>
							</thead>
							<tbody>
							</tbody>
						</table>

						<table border="0" cellpadding="0" cellspacing="0"
							class="operation">
							<thead>
								<tr>
									<td height="24">&nbsp;</td>
								</tr>
							</thead>
						</table>
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td>
			<table width="100%" border="0" cellpadding="0" cellspacing="0"
				class="table_padding">
				<tr>
					<td height="21" align="right">
						<table align="left">
							<tr>
								<td width="50px"><a class="button" href="javascript:void(0)" onclick="update();"><span>更新</span></a></td>
								<td width="50px"><a class="button" href="javascript:void(window.history.back());"><span>返回</span></a></td>
								<span id="mesg" style="color: red"></span>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
</form>
<script>
	$("input").blur(function(){
		var name = this.name;
		// var sp = this.next();
		switch (name) {
			case "code":
				var regExp = /[0-9]{3,16}/;
				var falg = regExp.test(this.value);
				alert(falg);
				if (falg){
					message = "可以使用";
				}else {
					messsge = "不可以使用";
				}
				alert(message);

				break;
			case "name":

				break;
			case "moduleUrl":

				break;
			case "operationUrl":

				break;
			case "orderNo":

				break;
		}
	});

	function update(){
		var flag = confirm("你确定要修改嘛？");
		if (flag){
			$.post("permission?method=update", $("#permissionForm").serialize(),function(result){
				if (result.code=="200"){
					$("#mesg").text(result.mesg);
					//更新节点信息
					var treeObj = parent.treeFrame.$.fn.zTree.getZTreeObj("permission_tree");
					var node = treeObj.getSelectedNodes()[0];
					node.name=$("#name").val();
					treeObj.updateNode(node);

				}else {
					$("#mesg").text(result.mesg);
				}
			});
		}
	}
</script>